Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Testing #19

Merged
merged 53 commits into from
Dec 9, 2024
Merged

Unit Testing #19

merged 53 commits into from
Dec 9, 2024

Conversation

gmitch215
Copy link
Member

@gmitch215 gmitch215 commented Nov 14, 2024

Closes #6.

Things to do:

  • Create Mock config.json
  • Deploy Test Docker Images for Jenkins, Nexus, and MariaDB
  • Create Unit Tests
    • Test Submit Command
    • Test Application Accept
    • Test Application Deny
    • Test All /codemc commands
      • Test /codemc jenkins
      • Test /codemc nexus
      • Test /codemc change-password
      • Test /codemc remove
      • Test /codemc link
      • Test /codemc unlink
      • Test /codemc createuser
      • Test /codemc deluser
      • Test /codemc validate with most edge cases
    • Test /msg Command
    • Test Utility Classes
      • Test APIUtil
      • Test ApplicationHandler
      • Test CommandUtil
    • Test Listeners
      • Test ButtonListener
      • Test ModalListener
  • Create Mock Objects using Mockito
  • Deploy to GitHub Workflow

Feel free to add more ideas.

@gmitch215 gmitch215 added the enhancement New feature or request label Nov 14, 2024
@gmitch215 gmitch215 requested a review from Andre601 November 14, 2024 17:32
@gmitch215 gmitch215 self-assigned this Nov 14, 2024
Copy link

Overall Project 9.56% -4.33%
Files changed 20%

File Coverage
ConfigHandler.java 72.33% -5.66%
CodeMCBot.java 50.62% -21.79%
ButtonListener.java 0% -10.89%
CmdApplication.java 0% -6.21%
CmdCodeMC.java 0% -0.89%

Copy link

Overall Project 24.93% -5.85%
Files changed 33.89%

File Coverage
ConfigHandler.java 72.33% -5.66%
CommandUtil.java 69.95% -15.27%
CodeMCBot.java 50.62% -21.79%
APIUtil.java 42.25% -20.54%
CmdCodeMC.java 39.31% -0.88%
ButtonListener.java 0% -10.89%
CmdApplication.java 0% -6.21%

Copy link

github-actions bot commented Dec 6, 2024

Overall Project 53.64% -5.32%
Files changed 48.63%

File Coverage
CmdCodeMC.java 79.99% -2.03%
CmdApplication.java 77.93%
ApplicationHandler.java 75.18%
CommandUtil.java 73.01% -13.72%
ConfigHandler.java 72.33% -5.66%
CodeMCBot.java 50.62% -21.79%
APIUtil.java 42.69% -22.69%
ButtonListener.java 0% -10.89%
ModalListener.java 0% -1.19%

Copy link

github-actions bot commented Dec 6, 2024

Overall Project 54.28% -5.09%
Files changed 50.86%

File Coverage
CmdCodeMC.java 79.99% -2.03%
CmdApplication.java 77.93%
ApplicationHandler.java 75.18%
CommandUtil.java 73.01% -13.72%
ConfigHandler.java 72.33% -5.66%
APIUtil.java 56.54% -17.69%
CodeMCBot.java 50.62% -21.79%
ButtonListener.java 0% -10.89%
ModalListener.java 0% -1.19%

Copy link

github-actions bot commented Dec 7, 2024

Overall Project 59.18% -4.4%
Files changed 57.49%

File Coverage
ButtonListener.java 87.46% -1.36%
CmdCodeMC.java 79.99% -2.03%
CommandUtil.java 78.76% -9.29%
CmdApplication.java 77.93%
ApplicationHandler.java 75.18%
ConfigHandler.java 72.33% -5.66%
APIUtil.java 56.54% -17.69%
CodeMCBot.java 50.62% -21.79%
ModalListener.java 0% -1.19%

Copy link

github-actions bot commented Dec 7, 2024

Overall Project 66.11% -4.45%
Files changed 59.94%

File Coverage
ButtonListener.java 87.46% -1.36%
CommandUtil.java 84.51% -4.87%
CmdCodeMC.java 79.99% -2.03%
CmdApplication.java 77.93%
ApplicationHandler.java 75.18%
ConfigHandler.java 72.33% -5.66%
APIUtil.java 56.54% -17.69%
CodeMCBot.java 50.62% -21.79%
ModalListener.java 49.73% -2.92%

Copy link

github-actions bot commented Dec 8, 2024

Overall Project 81.93% -4.66%
Files changed 62.94%

File Coverage
CmdMsg.java 94.15%
CommandUtil.java 90.71%
CmdApplication.java 89.31%
CmdCodeMC.java 89.16% -1.25%
ButtonListener.java 87.46% -1.36%
ModalListener.java 85.75% -7.58%
ApplicationHandler.java 81.61%
ConfigHandler.java 72.33% -5.66%
APIUtil.java 56.37% -17.76%
CodeMCBot.java 50.62% -21.79%

@gmitch215 gmitch215 marked this pull request as ready for review December 8, 2024 17:08
Copy link

github-actions bot commented Dec 8, 2024

Overall Project 81.94% -4.66%
Files changed 63.71%

File Coverage
CmdMsg.java 94.15%
CommandUtil.java 90.71%
CmdApplication.java 89.31%
CmdCodeMC.java 89.16% -1.25%
ButtonListener.java 87.46% -1.36%
ModalListener.java 85.75% -7.58%
ApplicationHandler.java 81.61%
ConfigHandler.java 72.33% -5.66%
APIUtil.java 56.37% -17.76%
CodeMCBot.java 50.7% -21.83%

@gmitch215
Copy link
Member Author

gmitch215 commented Dec 8, 2024

PR is done. Minimum 80% coverage standard is set.

Other things included:

  • Upgrades to Gradle 8.11.2.
  • Upgrades to API v1.2.0, which includes #exists functions and fixes a Database bug
  • Splits CodeMCBot actions into different functions, so that MockCodeMCBot can work properly without having to attempt to log in

Notable things discovered while testing:

  • There was a bug in /msg that set the max text size to 4096, which is the maximum size of an embed, yet modals max text size in general is 4000.
  • In a few of the commands, there were checks that were always true or false , or checks that were duplicated
  • Nexus API handles requests differently, never returning false for failure, meaning we would only know failures if an exception is thrown

@sgdc3
Copy link
Member

sgdc3 commented Dec 8, 2024

Looks good to me, nice job man! :)

Copy link
Collaborator

@Andre601 Andre601 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me... Tho my unit testing knowledge is limited...

@gmitch215 gmitch215 assigned sgdc3 and unassigned sgdc3 Dec 9, 2024
@gmitch215 gmitch215 requested review from sgdc3 and removed request for sgdc3 December 9, 2024 01:16
@gmitch215 gmitch215 merged commit 6571456 into master Dec 9, 2024
7 checks passed
@gmitch215 gmitch215 deleted the feat/unit-testing branch December 9, 2024 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Unit Testing
3 participants